import { request } from '@/common/request'
const api = {
	login: (data : { code : string }) => {
		return request({
			data,
			url: '/wxLogin',
			method: 'post',
		})
	},
	getWeather: () => {
		return request({
			url: '/agriculture/app/getWeather',
			method: 'get',
		}, { authorization: '' })
	},
	getAdoptList: () => {
		return request({
			url: '/agriculture/adopt/getAdoptList',
			method: 'post',
		})
	},
	getDefType: (type : string) => {
		return request({
			url: `/system/dict/data/type/${type}`,
			method: 'get',
		})
	},
	getAdoptById: (id : string) => {
		return request({
			data: { id },
			url: '/agriculture/adopt/getAdoptById',
			method: 'post',
		})
	},
	adoptCollect: (id : string, type : boolean) => {
		let url = type ? '/agriculture/adopt/addCollect' : '/agriculture/adopt/removeCollect'
		return request({
			data: { id },
			url: url,
			method: 'get',
		})
	},
	getAddrList: () => {
		return request({
			url: '/agriculture/address/getAddressList',
			method: 'get',
		})
	},
	addAddr: (data : any) => {
		return request({
			data,
			url: '/agriculture/address/add',
			method: 'post',
		})
	},
	editAddr: (data : any) => {
		return request({
			data,
			url: '/agriculture/address/update',
			method: 'post',
		})
	},
	delAddr: (data : any) => {
		return request({
			data,
			url: '/agriculture/address/delete',
			method: 'post',
		})
	},
	setAddrDefault: (data : any) => {
		return request({
			data,
			url: '/agriculture/address/setDefault',
			method: 'post',
		})
	},
	addFeedback: (data : any) => {
		return request({
			data,
			url: '/agriculture/opinion/add',
			method: 'post',
		})
	},
	getAddrDetail: (data : any) => {
		return request({
			data,
			url: '/agriculture/address/getAddressById',
			method: 'post',
		})
	},
	getFirstNews: () => {
		return request({
			url: '/agriculture/app/getNewsByApp',
			method: 'get',
		}, { authorization: '' })
	},
	getNewsList: (data : any) => {
		return request({
			data,
			url: '/agriculture/app/getNewsList',
			method: 'get',
		})
	},
	getNewsDetail: (data : any) => {
		return request({
			data,
			url: `/agriculture/app/news/${data.id}`,
			method: 'get',
		})
	},
	getLandList: (data : any) => {
		return request({
			data,
			url: `/agriculture/app/rent/page`,
			method: 'get',
		})
	},
	getLandDetail: (data : any) => {
		return request({
			data,
			url: `/agriculture/app/rent/${data.id}`,
			method: 'get',
		})
	},
	getLandDetailList: (data : any) => {
		return request({
			data,
			url: `/agriculture/app/rent/garden/countList`,
			method: 'get',
		})
	},
	getServiceList: (data : any) => {
		return request({
			data,
			url: `/agriculture/app/rent/garden/service/list`,
			method: 'get',
		})
	},
	getSeedList: (data : any) => {
		return request({
			data,
			url: `/agriculture/app/crop/page`,
			method: 'get',
		})
	},
	addSponsor: (data : any) => {
		return request({
			data,
			url: `/agriculture/adopt/record/add`,
			method: 'post',
		})
	},
	addRentOrder: (data : any) => {
		return request({
			data,
			url: `/agriculture/rent/garden/record/create`,
			method: 'post',
		})
	},
	getPlanPrice: (data : any) => {
		return request({
			data,
			url: `/agriculture/rent/garden/record/compute`,
			method: 'post',
		})
	},
	getOrderList: (data : any) => {
		return request({
			data,
			url: `/agriculture/rent/garden/record/list`,
			method: 'get',
		})
	},
	getAdoptOrderList: (data : any) => {
		return request({
			data,
			url: `/agriculture/farm/order/getOrderListByAdopt?status={data.status}`,
			method: 'get',
		})
	},
	cancelOrder: (data : any) => {
		return request({
			data,
			url: `/agriculture/rent/garden/record/cancel`,
			method: 'post',
		})
	},
	cancelAdoptOrder: (data : any) => {
		return request({
			data,
			url: `/agriculture/adopt/record/delete`,
			method: 'post',
		})
	},
	getUserInfo: () => {
		return request({
			url: `/getAppUser`,
			method: 'get',
		})
	},
	setUserInfo: (data) => {
		return request({
			data,
			url: `/updateAppUser`,
			method: 'post',
		})
	},
	getMonitorList: (data) => {
		return request({
			data,
			url: `/iot/device/shortList`,
			method: 'get',
		})
	},
	getMonitor: (deviceId : string) => {
		return request({
			url: `/sip/channel/list?deviceSipId=${deviceId}`,
			method: 'get',
		})
	},
	getVideo: (deviceId : string, channelId : string) => {
		return request({
			url: `/sip/player/play/${deviceId}/${channelId}`,
			method: 'get',
		})
	},
	getVideoLand: () => {
		return request({
			url: `/portal/screen/cropLandList`,
			method: 'post',
		})
	},
	moveVideo: (data : any) => {
		return request({
			data,
			url: `/sip/ptz/direction/${data.deviceId}/${data.channelId}`,
			method: 'post',
		})
	},
	scaleVideo: (data : any) => {
		return request({
			data,
			url: `/sip/ptz/scale/${data.deviceId}/${data.channelId}`,
			method: 'post',
		})
	},
	getAdoptRecordById: (data : any) => {
		return request({
			data,
			url: `/agriculture/adopt/record/getAdoptRecordById`,
			method: 'post',
		})
	},
	
	getRentRecordById: (data : any) => {
		return request({
			data,
			url: `/agriculture/rent/garden/record/${data.id}`,
			method: 'get',
		})
	},

	getPayRes: (data : any) => {
		return request({
			data,
			url: `/payapi/wxPay/pay`,
			method: 'post',
		}, null, 'https://www.tylxj.top/payapi/wxPay/pay')
	},
}
export default api